package com.xbongbong.paas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;

/**
 * @author: wufeng
 * @date: 2018/10/11 10:43
 * @desrcption: 需要过滤的字段（关联字段条件限定需要过滤的字段）
 */
public enum LinkConditionNeedFilterFieldEnum {

    SEPARATOR(10002, "separator", "basic", "enum.linkConditionNeedFilterField.description.separator"),
    MEMO(10004, "memo", "basic", "enum.linkConditionNeedFilterField.description.memo"),
    HREF(10005, "href", "basic", "enum.linkConditionNeedFilterField.description.href"),
    SUBFORM(10006, "subform", "complex", "enum.linkConditionNeedFilterField.description.subform"),
    LINKQUERY(10007, "linkquery", "complex", "enum.linkConditionNeedFilterField.description.linkquery"),
    LINKDATA(10008, "linkdata", "complex", "enum.linkConditionNeedFilterField.description.linkdata"),
    CREATOR(10013, "creator", "system", "enum.linkConditionNeedFilterField.description.creator"),
    CREATETIME(10014, "createtime", "system", "enum.linkConditionNeedFilterField.description.createtime"),
    UPDATETIME(10015, "updatetime", "system", "enum.linkConditionNeedFilterField.description.updatetime"),
    USERDETP(10016, "userdept", "system", "enum.linkConditionNeedFilterField.description.userdetp"),
    OWNER(10017, "owner", "system", "enum.linkConditionNeedFilterField.description.owner"),
    SYNERGETIC(10018, "synergetic", "system", "enum.linkConditionNeedFilterField.description.synergetic"),
    SERIALNUM(10019, "serialnum", "system", "enum.linkConditionNeedFilterField.description.serialnum");

    /**
     * 字段类型
     */
    private Integer type;
    /**
     * 字段类型英文
     */
    private String alias;
    /**
     * 字段所属
     */
    private String belong;

    /**
     * 字段描述
     */
    private String description;

    LinkConditionNeedFilterFieldEnum(Integer type, String alias, String belong, String description){
        this.type = type;
        this.alias = alias;
        this.belong = belong;
        this.description = description;
    }

    public static LinkConditionNeedFilterFieldEnum getFieldTypeEnum(Integer type) {
        for (LinkConditionNeedFilterFieldEnum e: values()) {
            if(type.equals(e.getType())){
                return e;
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public String getAlias() {
        return alias;
    }

    public String getBelong() {
        return belong;
    }

    public String getDescription() {
        return I18nMessageUtil.getMessage(description);
    }
}
